
 
 4   l i n e   b y   2 0   c h a r a c t e r   L C D   d s i p l a y L C D   p a r a l l e l   d e m o   u s i n g   t h e   H i t a c h i   H D 4 4 7 8 0   L C D   c o n t r o l l e r . 
 
 V 1 . 2   M a d e   s o m e   c h a n g e s   t o   t h e   L C D D E M O   o b j e c t   t o   a l l o w   c u s t o m   c h a r a c t e r s   t o   c h a n g e   t h e m   o n   t h e   f l y   a n d   s o m e   e x t r a   m e t h o d s .   T h i s   i s   f o r   d i s p l a y s   u s i n g   t h e   H i t a c h i   H D 4 4 7 8 0   L C D   c o n t r o l l e r .   
 
 D E M O L C D . s p i n   u s e s   L C D D E M O   t o   s h o w   t h e   u s e s   o f   t h e   m e t h o d s . 
 
 
 
 
 
 
 
 
 
 
 
 { { 
 
 L C D D E M O   V e r s i o n   1 . 2   A p r i l   2 1 , 2 0 0 7 
 
 A d d e d   t h e   a b i l i t y   t o   d e f i n e   c u s t o m   c h a r a c t e r s 
 
 A d d e d   t h e   a b i l i t y   t o   c h a n g e   a l r e a d y   d e f i n e d   c u s t o m   c h a r a c t e r s   w h i l e   t h e y ' r e   b e i n g   d i s p l a y e d 
 
 C h a n g e d   m e t h o d   t o   s e n d   c o m m a n d s   t o   t h e   L C D   a   p u b l i c   m e t h o d     
 
 A d d e d   c l e a r   c u r r e n t   l i n e 
 
 F i x e d   s o m e   m i n o r   p r o b l e m s 
 
 R e m o v e d   u s e   o f   e s c a p e   t o   d i s p l a y   c h a r a c t e r s . 
 
 L e g a l   c h a r a c t e r   c o d e s   a r e   n o w ,   0 - 7   a n d   3 2 - 1 2 7 
 
 
 
 V e r s i o n   1 . 1   A p r i l   1 6 , 2 0 0 7 
 
 A d d e d   t h e   e s c a p e   c h a r a c t e r   t e s t   i n   t h e   s t r i n g   o u t p u t 
 
 s o   t h a t   a n y   c h a r a c t e r   ( 0 - 2 5 5 )   c a n   b e   s e n t   t o   t h e   d i s p l a y 
 
 A d d e d   l i n e s   p e r   d i s p l a y   ( l c d l i n e s )   s o   t h a t   o t h e r   d i s p l a y s 
 
 ( 1   t o   n   l i n e s )   c a n   b e   u s e d . 
 
 
 
 4   b i t   p a r a l l e l   i n t e r f a c e   t o   a 
 
 4   l i n e   b y   2 0   c h a r a c t e r   L C D 
 
 W h i c h   u s e s   t h e   H i t a c h i   H D 4 4 7 8 0   L C D   c o n t r o l l e r 
 
 
 
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 * * * * *     D O   N O T   s e t   t h e   c l o c k   f o r   R C M O D E = S L O W     * * * * * 
 
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 
 
 
 
 T h e s e   a r e   t h e   c o n n e c t i o n s   I   u s e d 
 
 
 
     P O R T A                     L C D   D i s p l a y 
 
                       % % % % %  P I N   1     G N D 
 
                       %  + 5 V   P I N   2     V C C 
 
                       #% % % % %  P I N   3     C o n t r a s t 
 
     P I N   5    % % %<% % % % %  P I N   4     E n a b l e 
 
                       #% % % % %  P I N   5     R D / ! W R 
 
     P I N   4    % % %<% % % % %  P I N   6     R e g i s t e r   S e l e c t 
 
                       #% % % % %  P I N   7     D 0 
 
                     %K% % % % %  P I N   8     D 1 
 
                     #% % % % %  P I N   9     D 2 
 
                       % % % % %  P I N   1 0   D 3 
 
     P I N   3  % % % % % % % % %  P I N   1 1   D 4 
 
     P I N   2  % % % % % % % % %  P I N   1 2   D 5 
 
     P I N   1  % % % % % % % % %  P I N   1 3   D 6 
 
     P I N   0  % % % % % % % % %  P I N   1 4   D 7   
 
 
 
 
 
 
 
 M e t h o d s   u s e d   i n   L C D D E M O : 
 
 p u b   i n i t     ' I n i t i a l i z e   t h e   L C D   t o   f o u r   b i t   m o d e   a n d   c l e a r   i t 
 
 p u b   w r i t e s t r ( s t r i n g p t r )                     W r i t e   o u t   a   s t r i n g   t o   t h e   L C D 
 
 p u b   w r i t e c g ( C h a r C o d e ,   s t r i n g p t r )   W r i t e   c u s t o m   c h a r a c t e r s   t o   t h e   c g   r a m 
 
 p u b   w r i t e c g l i n e ( C h a r C o d e ,   C h a r L i n e ,   s t r i n g p t r )   W r i t e   a   l i n e   i n t o   a   c u s t o m   c h a r a c t e r 
 
 p u b   c o m m a n d O u t ( c o d e )                           W r i t e   o u t   a   c o m m a n d   t o   t h e   d i s p l a y   c o n t r o l l e r 
 
 p u b   w r i t e O u t ( c h a r a c t e r )                     W r i t e   o u t   a   s i n g l e   c h a r a c t e r   t o   t h e   d i s p l a y 
 
 p u b   c l s                                                     C l e a r   t h e   d i s p l a y 
 
 p u b   c l l                                                     C l e a r   t h e   c u r r e n t   l i n e 
 
 p u b   c u r s o r _ o n                                         T u r n   t h e   c u r s o r   a n d   b l i n k   o n 
 
 p u b   c u r s o r _ o f f                                       T u r n   t h e   c u r s o r   a n d   b l i n k   o f f 
 
 p u b   p o s ( l i n e , c o l u m n )                           S e t   t h e   p o s i t i o n 
 
 p u b   h o m e                                                   G o   b a c k   t o   t h e   s t a r t   o f   t h e   l i n e 
 
 p u b   u S d e l a y ( D e l a y u S )                           D e l a y   f o r   #   o f   m i c r o s e c o n d s 
 
 
 
                                                                 M e t h o d   D e s c r i p t o n s : 
 
                                                                 
 
                 i n i t                                           I n i t i a l i z e   t h e   L C D 
 
 
 
                 w r i t e s t r ( @ s t r i n g )                 W r i t e   a   s t r i n g   a t   t h e   c u r r e n t   p o s i t i o n 
 
                                 I f   t h e   s t r i n g   i s   t e r m i n a t e d   b y   a   c a r r i a g e   r e t u r n   ( $ 0 D )   o r 
 
                                 l i n e   f e e d   ( $ 0 A )   t h e n   t h e   p o s i t i o n   w i l l   m o v e   t o   t h e   n e x t   l i n e 
 
                                 I f   t h e   s t r i n g   e x c e e d s   t h e   l i n e   l e n g t h ,   t h e n   i t   w i l l   w r a p   t o   t h e   n e x t 
 
                                 l i n e .   I f   t h i s   o c c u r s   o n   t h e   l a s t   l i n e ,   i t   w i l l   w r a p   t o   t h e   f i r s t   l i n e                 
 
 
 
                 w r i t e c g ( c h a r a c t e r   c o d e ,   @ s t r i n g )   W r i t e   a   c u s t o m   c h a r a c t e r   t o   t h e   c g   r a m 
 
                                 C h a r a c t e r   c o d e s   m a y   b e   0 - 7 
 
                                 s t r i n g   c o n t a i n s   t h e   d a t a   f o r   t h e   c o d e ( s ) 
 
                                 m o r e   t h a n   o n e   c h a r a c t e r   m a y   b e   w r i t t e n   a t   a   t i m e 
 
                                 C r e a t i o n   o f   c u s t o m   c h a r a c t e r s   i s   e a s e d   b y   u s i n g   t h e 
 
                                 L C D   C h a r a c t e r   C r e a t o r   f r o m   P a r a l l a x   b u t   c o p y   o n l y   t h e   h e x   c o d e   p o r t i o n   f r o m 
 
                                 t h e   L C D   C h a r a c t e r   C r e a t o r 
 
                                     W R O N G :   C h a r 0   D A T A   $ 0 0 , $ 0 0 , $ 0 0 , $ 0 0 , $ 0 0 , $ 0 0 , $ 0 0 , $ 0 0 
 
                                     R I G H T :   $ 0 0 , $ 0 0 , $ 0 0 , $ 0 0 , $ 0 0 , $ 0 0 , $ 0 0 , $ 0 0   
 
                                 T e r m i n a t e   t h e   w r i t e   p r o c e s s   w i t h   a n   e o g   ( $ F F ) 
 
 
 
                 w r i t e c g l i n e ( c h a r a c t e r   c o d e ,   c h a r a c t e r   l i n e ,   @ s t r i n g ) 
 
                                 C h a r a c t e r   c o d e s   m a y   b e   0 - 7 
 
                                 C h a r a c t e r   l i n e s   m a y   b e   0 - 7 
 
                                 T e r m i n a t e   t h e   s a m e   w a y   a s   w r i t e c g   ( e o g ) 
 
 
 
                 c o m m a n d O u t ( c o d e )                   W r i t e   a   c o m m a n d   t o   t h e   d i s p l a y   c o n t r o l l e r 
 
 
 
                 w r i t e O u t ( " c h a r a c t e r " )         W r i t e   a   s i n g l e   c h a r a c t e r   a t   t h e   c u r r e n t   p o s i t i o n 
 
 
 
                 c l s                                             C l e a r   t h e   d i s p l a y 
 
 
 
                 c l l                                             C l e a r   t h e   c u r r e n t   l i n e 
 
                 
 
                 c u r s o r _ o n                                 C u r s o r   o n   a n d   b l i n k i n g 
 
                 
 
                 c u r s o r _ o f f                               T u r n   t h e   c u r s o r   o f f .   O f f   i s   d e f a u l t   a f t e r   i n i t i a l i z a t i o n 
 
 
 
                 p o s ( l i n e ,   c o l u m n )                 S e t   p o s i t i o n   a t   l i n e   1 - 4 ,   c o l u m n   1 - 2 0 
 
                 
 
                 h o m e                                           H o m e   t o   t h e   b e g i n n i n g   o f   t h e   c u r r e n t   l i n e 
 
                 
 
                 u S d e l a y ( # m i c r o s e c o n d s )       D e l a y   a   s p e c i f i c   n u m b e r   o f   m i c r o s e c o n d s 
 
 
 
 O b j e c t   " L C D D E M O "   I n t e r f a c e : 
 
 
 
 P U B     i n i t 
 
 P U B     w r i t e s t r ( s t r i n g p t r ) 
 
 P U B     w r i t e c g ( C h a r C o d e ,   s t r i n g p t r ) 
 
 P U B     w r i t e c g l i n e ( C h a r C o d e ,   C h a r L i n e ,   s t r i n g p t r ) 
 
 P U B     c o m m a n d O u t ( c h a r ) 
 
 P U B     w r i t e O u t ( c h a r a c t e r ) 
 
 P U B     c l s 
 
 P U B     c l l 
 
 P U B     c u r s o r _ o n 
 
 P U B     c u r s o r _ o f f 
 
 P U B     p o s ( l i n e ,   c o l u m n ) 
 
 P U B     h o m e 
 
 P U B     u S d e l a y ( D e l a y u S ) 
 
 
 
 P r o g r a m :           1 4 6   L o n g s 
 
 V a r i a b l e :             1   L o n g s 
 
 } } 